package com.lj.back.manage.scaffold.module.sys.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lj.back.manage.scaffold.module.sys.DO.SysPermDO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import javax.validation.constraints.NotNull;
import java.util.Set;

/**
 * @author lv
 * @version 1.0.0
 */
@Repository
@Mapper
public interface SysPermDao extends BaseMapper<SysPermDO> {

    /**
     * 根据菜单查询权限列表
     * @param menuId 菜单ID
     * @return 权限列表
     */
    Set<String> selectPermByMenu(@NotNull(message = "{menu.id.notnull}") long menuId);

    /**
     * 绑定菜单和权限
     * @param menuId
     * @param id
     * @return
     */
    int bindMenuAndPerm(@NotNull(message = "{menu.id.notnull}") Long menuId,
                        @NotNull(message = "{perm.id.notnull}") Long id);
}
